Skip to content

fix(datastore): make restore_config optional() to match x-ui-overrides-only#367

Merged
unni-facets merged 2 commits into
mainfrom
fix/datastore-restore-config-optional
Jul 6, 2026
Merged

fix(datastore): make restore_config optional() to match x-ui-overrides-only#367
unni-facets merged 2 commits into
mainfrom
fix/datastore-restore-config-optional

Conversation

@srikxcipher

Copy link
Copy Markdown
Contributor

What

Wraps restore_config in optional(...) with safe defaults across 6 datastore modules.

Why

These modules mark restore_config as x-ui-overrides-only: true in facets.yaml (so it isn't a primary spec field), but declared it as a non-optional attribute in variables.tf. The result:

  • A spec that omits restore_config passes schema validation.
  • Server-side terraform plan then fails: attribute "restore_config" is required.

The caller got no signal until plan time that a schema-passing spec was incomplete. Surfaced during the 2026-06-24 multi-cloud validation run (worked around at apply time by setting the block explicitly).

Changes

restore_config = object({...})restore_config = optional(object({...}), <default>):

Module Default
mysql/aws-rds { restore_from_backup = false }
postgres/aws-rds { restore_from_backup = false }
mysql/gcp-cloudsql { restore_from_backup = false }
postgres/gcp-cloudsql { restore_from_backup = false }
redis/gcp-memorystore { restore_from_backup = false }
mysql/flexible_server (azure) {} (all fields already optional)

Existing validation blocks (mysql/gcp-cloudsql, mysql/flexible_server) already short-circuit on the no-restore path, so behavior is unchanged when the block is provided.

Scope notes

  • imports was already optional() in every module — no change needed.
  • postgres/azure-flexible-server and redis/aws-elasticache were already clean.
  • redis/gcp-memorystore had the same drift (not in the original ticket) — included here.
  • terraform fmt -check passes on all 6.

🤖 Generated with Claude Code

srikxcipher and others added 2 commits June 24, 2026 22:21
…s-only

Several datastore modules marked restore_config x-ui-overrides-only in
facets.yaml (not a primary spec field) but declared it as a non-optional
attribute in variables.tf. A spec that omitted restore_config passed schema
validation, then failed terraform plan with
`attribute "restore_config" is required` — no signal until plan time.

Wrap restore_config in optional(...) with a safe default (restore_from_backup
= false; {} for the all-optional azure mysql block) so the un-set case just
works. Existing validations already short-circuit on the no-restore path, so
behavior is unchanged when the block is provided.

Modules fixed: mysql/aws-rds, postgres/aws-rds, mysql/gcp-cloudsql,
postgres/gcp-cloudsql, mysql/flexible_server, redis/gcp-memorystore.
(imports was already optional everywhere; azure postgres + aws redis already
clean.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@unni-facets
unni-facets merged commit 76a2e4b into main Jul 6, 2026
@unni-facets
unni-facets deleted the fix/datastore-restore-config-optional branch July 6, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants